package com.you.mavenbuildtest.clone;

public class Shape implements Cloneable{
    private String id;
    private Sub sub;

    public Object clone(){
        Object clone = null;
        try {
            clone = super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return clone;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Sub getSub() {
        return sub;
    }

    public void setSub(Sub sub) {
        this.sub = sub;
    }

    public static void main(String[] args) {
        Shape shape = new Shape();
        Shape shape1 = (Shape)shape.clone();
        Sub sub = new Sub();
        sub.setSubId("1");
        shape.setSub(sub);
        System.out.println(shape.getSub().getSubId());
        System.out.println(shape1.getSub().getSubId());
    }
}
